<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>元素透明度设置</title>
    <style>
        .box{
            width: 600px;
            margin: 100px auto;
            border: 2px solid #e90d0d;
        }
        
        img{
            width: 600px;
            vertical-align: top;
        }
        /* .box:hover{
            opacity: 0.8;
            只能使用从 0 ~ 1之间的值，不能使用百分比
        } */
        img:hover{
            filter: opacity(80%);
        }
    </style>
</head>
<body>
    <div class="box">
        <img src="../image/2.jpg">
    </div>
</body>
</html>